const initialState = {
    selected: []
};

export const actionsTypes = {
    SET_SELECTED: "SET_SELECTED",
    RESPONSE_SELECTED: "RESPONSE_SELECTED",
    ASSIGN: "ASSIGN"
};

export const actions = {
 
    set_selected: function (data) {
        return {
            type: actionsTypes.SET_SELECTED,
            data
        }
    },
    assign : function (project_id, data) {
        return {
            type: actionsTypes.ASSIGN,
            project_id,
            data
        }
    }
}

export function reducer(state=initialState, action) {
    switch (action.type) {
        case actionsTypes.RESPONSE_SELECTED:
            return {
                ...state,
                selected: action.data
            }   
        default:
            return state
    }
}